
\subsection{Problem 2 (8)}

Recommended, 8 Points: Next, apply the single-path transformation to this implementation. In theory, loop bounds are unnecessary for single path code, and, on a suitable platform, execution time variations should be minimal. Investigate whether this is the case, using the test driver developed in the previous problem, and using aiT.
\\
\\
\textbf{Solution:}
\\
\\
As you can see in Section~\ref{sec:v2_singlep}, for getting a single-path version of our algorithm, we converted the 2 while-loops into 2 bounded for-loops plus the necessary conditional if statements. For this purpose we also had to introduce new variables "`res\_k"', "`res\_cross"' and "`cancel"' for temporally saving the results of the new conditional statements. Because of the single-path version, the results of the software measurement got worse: 66795 cycles.  \textit{aiT} computed a WCET of 142364 cycles (see Figure~\ref{fig:v2_ait}) and normally, loop bounds shouldn't be necessary any more. Unfortunately, \textit{aiT} didn't really manage to find our new loop bounds automatically, so we still had to annotate them in our \textit{.ais-file} (see section ~\ref{sec:ais_v2}).

\begin{figure}[!htbp]
	\centering
		\includegraphics[width=0.50\textwidth]{figures/v2_ait.png}
	\caption{aiT analysis v2}
	\label{fig:v2_ait}
\end{figure}